<template>
  <div class="nb-header">
    <mt-header :title="title">
      <span v-if="isShowBack" @click="goBack" slot="left">
        <mt-button icon="back">返回</mt-button>
      </span>
    </mt-header>
  </div>
</template>

<script>
export default {
  data () {
    return {
      isShowBack: false,
      title: 'NB MALL'
    }
  },
  methods: {
    goBack () {
      this.$router.back()
    }
  },
  created () {
    this.$bus.$on('changeTitle', (title) => {
      this.title = title
    })
    this.$bus.$on('toggleBackDisplay', (show = false) => {
      this.isShowBack = show
    })
  }
}
</script>

<style lang="scss" scoped>
  .nb-header {
    & .mint-header {
      background-color: #c00;
    }
  }
</style>
